<#assign module="marketing"/>

<@override name="header">
<link rel="stylesheet" href="${ctx}/assets/css/bootstrap-multiselect.css">
<link rel="stylesheet" href="${ctx}/assets/css/datetimepicker.css">
</@override>
<@override name="body">

	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-default">
				<div class="panel-heading">
					编辑首单免费优惠活动
					<label class="control-label"><font color="red">（带*表示必填项）</font></label>
			    </div>
			    <div class="panel-body">
    				<form id="submit_form" action="${ctx}/activity/update" class="form-horizontal" method="post">
    					<input type="hidden" name="id" value="${activity.id}">
		               	<input type="hidden" id="activityEvent" name="activityEvent" value="firstOrderFree" />
		               	<input type="hidden" id="restriction" name="restriction" value="${activity.restriction}" />
		               	<@shiro.isMainCompany>
		               		<div class="form-group">
			                    <label class="col-sm-3 control-label"><em>*</em>所属公司：</label>
			                    <div class="col-sm-3">
			                    	<input type="hidden" id="companyNames" name="companyNames" value="" />
			                    	<select class="form-control" id="companyIds" name="companyIds" multiple="multiple" required>
			                    		<#if companys??>
			                    			<#list companys as company>
			                    				<option value="${company.id}" <#if activity.companyIds?contains(','+company.id+',')>selected="selected"</#if>>${company.abbreviation?if_exists}</option>
			                    			</#list>
			                    		</#if>
			                    	</select>
			                    </div>
			                </div>
		               	</@shiro.isMainCompany>
		               
		                <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>客户类型：</label>
		                    <div class="col-sm-3">
		                    	<select class="form-control" id="activityTarget" name="activityTarget" required>
		                    		<option value="all" <#if activity.activityTarget=='all'>selected="selected"</#if>>所有客户</option>
		                    		<option value="passenger" <#if activity.activityTarget=='passenger'>selected="selected"</#if>>个人客户</option>
		                    		<option value="enterprise" <#if activity.activityTarget=='enterprise'>selected="selected"</#if>>企业客户</option>
		                    	</select>
		                    </div>
		                </div>
		                
		                <div class="form-group">
		                    <label class="col-sm-3 control-label">客户等级：</label>
		                    <div class="col-sm-3">
		                    	<input type="hidden" id="gradeNames" name="gradeNames" value="" />
		                    	<select class="form-control" id="gradeIds" name="gradeIds" multiple="multiple" required>
		                    		<#if grades??>
		                    			<#list grades as grade>
		                    				<option value="${grade.id}" <#if activity.gradeIds??><#if activity.gradeIds?contains(','+grade.id+',')>selected="selected"</#if></#if>>${grade.name?if_exists}</option>
		                    			</#list>
		                    		</#if>
		                    	</select>
		                    </div>
		                </div>
		                
		                <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>订单来源：</label>
		                    <div class="col-sm-3">
		                    	<select class="form-control" id="orderFromSource" name="orderFromSource" multiple="multiple" required>
                    				<option value="电话预约" <#if activity.orderFromSource?contains('电话预约')>selected="selected"</#if>>电话预约</option>
                    				<option value="司机补单" <#if activity.orderFromSource?contains('司机补单')>selected="selected"</#if>>服务人员补单</option>
                    				<option value="APP预约" <#if activity.orderFromSource?contains('APP预约')>selected="selected"</#if>>APP预约</option>
                    				<option value="微信预约" <#if activity.orderFromSource?contains('微信预约')>selected="selected"</#if>>微信预约</option>
                    				<option value="小程序" <#if activity.orderFromSource?contains('小程序')>selected="selected"</#if>>小程序</option>
                    				<option value="客户经理" <#if activity.orderFromSource?contains('客户经理')>selected="selected"</#if>>客户经理</option>
                    				<option value="网站预约" <#if activity.orderFromSource?contains('网站预约')>selected="selected"</#if>>网站预约</option>
		                    	</select>
		                    </div>
		                </div>
		                
		                <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>订单类型：</label>
		                    <div class="col-sm-3">
		                    	<p class="form-control-static">
		                    		<#if activity.orderType=="daijia">
		                    			代驾
		                    		<#elseif activity.orderType=="zhuanche">
		                    			专车
	                    			<#elseif activity.orderType=="errand">
	                    				跑腿
		                    		<#elseif activity.orderType=="freight">
		                    			货运
		                    		<#elseif activity.orderType=="zhuanxian">
		                    			快车
		                    		</#if>
		                    	<p>
		                    </div>
		                </div>

		                <div class="form-group" style="display:none;">
		                    <label class="col-sm-3 control-label"><em>*</em>免费类型：</label>
		                    <div class="col-sm-3">
		                    	<p class="form-control-static">
		                    		<#if activity.freeType==0>
		                    			全部免除
		                    		<#elseif activity.freeType==1>
		                    			免除起步价
		                    		<#elseif activity.freeType==2>
		                    			自定义免除费用
		                    		</#if>
		                    	<p>
		                    </div>
		                </div>
		                <#if activity.freeType==2>
		                	<div class="form-group">
			                    <label class="col-sm-3 control-label"><em>*</em>免除金额：</label>
			                    <div class="col-sm-3">
			                    	<p class="form-control-static">
			                    		${activity.otherMoney?if_exists}元
			                    	<p>
			                    </div>
			                </div>
		                </#if>
		                
		                <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>有效期：</label>
		                    <div class="col-sm-3">
		                    	<input class="form-control" id="start" type="text" value="${activity.startDate?string('yyyy-MM-dd')}" disabled/>
		                    </div>
		                    <label style="float:left;" class="control-label">-</label>
		                    <div class="col-sm-3">
		                    	<input class="form-control" id="end" name="end" type="text" <#if activity.endDate??>value="${activity.endDate?string('yyyy-MM-dd')}"</#if> />
		                    </div>
		                </div>
		                
		                <div class="form-group">
					    	<label class="col-sm-3 control-label">通知方式：</label>
		                	<div class="col-sm-3">
		                		<p class="form-control-static">
									<label style="padding-right:12px;">
									  <input type="checkbox" name="messageType" value="sms" <#if activity.messageType?? && activity.messageType?contains('sms')>checked="checked"</#if>/> 短信
									</label>
									<label style="padding-right:12px;">
									  <input type="checkbox" name="messageType" value="message" <#if activity.messageType?? && activity.messageType?contains('message')>checked="checked"</#if>/> 应用通知
									</label>
								</p>
							</div>
					    </div>
		                
		                
		                <div class="form-group" style="margin-left:10px;">
		                	<label class="col-sm-3 control-label"></label>
			                <input id="submit_button" type="button" class="btn btn-primary" value="保存">
			                <input type="button" class="btn btn-default" onclick="window.location.href = '${ctx}/activity/list?event=firstOrderFree';" value="返回">
			            </div>
			            
					</form>
        		</div>
			</div>
		</div>
	</div>

</@override>
<@override name="footer">
<script type="text/javascript">
	var main=false;
	<@shiro.isMainCompany>
		main=true;
	</@shiro.isMainCompany>
</script>
<script src="${ctx}/assets/js/bootstrap-multiselect.js"></script>
<script src="${ctx}/assets/js/bootstrap-datetimepicker.min.js"></script>
<script src="${ctx}/assets/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="${ctx}/assets/js/activity/editfirstorderfree.js"></script>
</@override>
<@extends name="../layout.ftl"/>
